#include<stdio.h>
#include<string.h>
int main ()
{
	int a[100][100];
	int x;
	int y;
	int n;
	int num;
	int i;
	int j;
	scanf("%d",&n);

	x=0;
	y=0;
	num=1;
	for(i=0; i<n+1; i++)
	{
		for(j=0; j<n+1; j++)
		{
			a[i][j]=0;
		}
	}
	a[0][0]=1;
	while(num<n*n)
	{

		while(y+1<n&&!a[x][y+1])
		{
			a[x][++y]=++num;
			//printf("%d",num);
		}
		while(x+1<n&&!a[x+1][y])
		{
			a[++x][y]=++num;
			//printf("%d",num);
		}
		while(y-1>=0&&!a[x][y-1])
		{
			a[x][--y]=++num;
			//printf("%d",num);
		}
		while(x-1>=0&&!a[x-1][y])
		{
			a[--x][y]=++num;
			//printf("%d",num);
		}
	}
//		printf("\n");
	for(i=0; i<n; i++)
	{
		for(j=0; j<n; j++)
		{
			if(n<=3)
			{
				if(j==0)
				{
					printf("%d",a[i][j]);
				}
				else
				{
					printf("%2d",a[i][j]);
				}
			}
			else
			{
				if(j==0)
				{
					printf("%2d",a[i][j]);
				}
				else
				{
					printf("%3d",a[i][j]);
				}
			}
		}
		printf("\n");
	}

	return 0;
}
